/* SPDX-License-Identifier: GPL-2.0 */
/*
 *
 * Copyright (C) 2016-2022, LomboTech Co.Ltd.
 * Author: lomboswer <lomboswer@lombotech.com>
 *
 * Driver of LomboTech Nx platform usb2 phy driver
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 as
 * published by the Free Software Foundation.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 */

#ifndef __PHY_NX_USB_H__
#define __PHY_NX_USB_H__

#include <linux/io.h>
#include <linux/usb/otg.h>

#define READREG32(reg)			readl(reg)
#define WRITEREG32(reg, val)		writel(val, reg)

struct lb_nx_usbphy;

struct lb_nx_usbphy_soc_ops {
	int (*init)(struct lb_nx_usbphy *nx_usb_phy);
	void (*shutdown)(struct lb_nx_usbphy *nx_usb_phy);
	int (*suspend)(struct lb_nx_usbphy *nx_usb_phy, int is_suspend);
};

struct lb_nx_usbphy {
	struct device			*dev;
	struct device_node		*of_node;

	struct resource			*res;
	void __iomem			*reg_base;

	struct clk			*clk_reset;

	struct lb_nx_usbphy_soc_ops	*soc_ops;

	struct usb_phy			phy;
};

typedef struct lb_nx_usbphy_soc_ops *(*lb_nx_usbphy_get_soc_ops)(void);

#endif	/* __PHY_NX_USB_H__ */
